<html>
<head>
<title>ASP.NET Validation Controls</title>
<!-- #include file="style.inc" -->
</head>
<body bgcolor="#ffffff">
<!--------------------------------------------------------------------------->
<span class="heading">RangeValidator</span> &nbsp; &nbsp; &nbsp;
<form runat="server" action="getvalue.aspx" method="post">
 <table border="0">

<tr>
  <td valign="top">A Number between 1 and 100</td>
  <td><input type="text" id="txtNo" 
	maxlength="8" size="20" runat="server" />
	<asp:RequiredFieldValidator 
	id="valRequired" runat="server"
           ControlToValidate="txtNo"
           ErrorMessage="* You must enter a number between 1 and 100"
           Display="dynamic">
           *
      </asp:RequiredFieldValidator> <br />
     <asp:RangeValidator id="valRange" runat="server"
           ControlToValidate="txtNo"
           MaximumValue="100"
           MinimumValue="1"
           Type="Integer"
           ErrorMessage="* You must enter a number between 1 and 100"
           Display="dynamic">
           Please enter valid integer number.
      </asp:RangeValidator>
  </td>
 </tr>
 </table>

<asp:ValidationSummary id="valSummary" runat="server"
     HeaderText="<b>The following errors were found:</b>"
     ShowSummary="true" DisplayMode="List" />

<hr />
Validation Enabled:
<asp:DropDownList AutoPostBack="True" id="lstEnabled" runat="server">
<asp:ListItem Text="True" /><asp:ListItem Text="False" /></asp:DropDownList>
<p />&nbsp; &nbsp;
<input type="submit" id="cmdConfirm" value="Submit" runat="server" onserverclick="ConfirmEntry">&nbsp; &nbsp;
<input type="submit" id="cmdCancel" value="Cancel" runat="server" onserverclick="CancelEntry">&nbsp; &nbsp;
</form>
<div id="outMessage" EnableViewState="False" runat="server" />
<script language="VB" runat="server">

Sub Page_Load()

  Dim objValidator As BaseValidator
  For Each objValidator In Page.Validators
    objValidator.Enabled = lstEnabled.SelectedItem.Text   
    objValidator.EnableClientScript=False
  Next
  
End Sub



Sub ConfirmEntry(objSender As Object, objArgs As EventArgs)
  outMessage.InnerHtml = "Page.IsValid returned <b>" & Page.IsValid & ".</b>"
End Sub

Sub CancelEntry(objSender As Object, objArgs As EventArgs)
  outMessage.InnerHtml = "Validation was not carried out."
End Sub

</script>
<!--------------------------------------------------------------------------->
<!-- #include file="foot.inc" -->
</body>
</html>

